package com.xw.bo.ks.controller;

import com.xw.bo.ks.entity.base.BoPage;
import com.xw.bo.ks.entity.login.LoginVo;
import com.xw.bo.ks.entity.login.PageUserReq;
import org.springframework.web.bind.annotation.*;
import com.xw.bo.ks.entity.UserRegisterInfo;
import com.xw.bo.ks.service.UserRegisterInfoService;
import com.xw.bo.ks.entity.bean.UserRegisterInfoReq;

import javax.annotation.Resource;

/**
 * @author： xw ftl auto
 * @create： 2024-08-22 16:21:46
 */
@RestController
@RequestMapping("/userRegisterInfo")
public class UserRegisterInfoController extends BaseController{

    @Resource
    private UserRegisterInfoService userRegisterInfoService;

    /**
     * 删除
     */
    @PostMapping("/login")
    public String loginRegisterInfo(@RequestBody LoginVo loginVo) {
        return userRegisterInfoService.loginBackToken(loginVo.getName(),loginVo.getPassword());
    }

    @GetMapping("/getUserInfo")
    public UserRegisterInfo getUserInfo() {
        return userRegisterInfoService.getUserInfo(token.get());
    }

    @PostMapping("/page/userInfo")
    public BoPage<UserRegisterInfo> pageUserInfo(@RequestBody PageUserReq pageUserReq) {
        UserRegisterInfoReq loginVo = new UserRegisterInfoReq();
        loginVo.setRegisterUserId(pageUserReq.getRegisterUserId());
        loginVo.setPageNumber(pageUserReq.getPageNumber());
        loginVo.setPageSize(pageUserReq.getPageSize());
        return userRegisterInfoService.pageUserRegisterInfoMapper(loginVo);
    }

    @GetMapping("/testHttp")
    public String testHttp() {
        return "测试一下";
    }

}
